<template>
  <div id="app">
    userName: {{ $store.state.userName }} <br>
    userName: {{ $store.getters.fullName }} <br>
    <button @click="syncChangeName">同步修改 userName</button>
    <button @click="asyncChangeName">异步修改 userName</button>
  </div>
</template>

<script>
export default {
  name: 'App',
  methods: {
    syncChangeName () {
      this.$store.commit('CHANGE_NAME', 'new name...')
    },
    asyncChangeName () {
      this.$store.dispatch('changeName', 'new name...')
    }
  }
}
</script>

<style>
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  margin-top: 60px;
}
</style>
